/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.creature.sprite.plugin;

import java.awt.Image;
import model.creature.sprite.DefaultAttackerSprite;
import model.game.GameInterface;
import model.utility.ImageUtility;

/**
 * Attacks monsters at night at far range.
 * @author dolphinigle
 */
public class Mage extends DefaultAttackerSprite {

  /**
   * Constructor
   */
  public Mage(GameInterface game) {
    super(game, game.getMaps().getField().getCellAt(1,1));
  }

  @Override
  public int getHiringPrice() {
    return 500 + getLevel() * 250;
  }

  @Override
  public String getName() {
    return "Mage";
  }

  @Override
  public String getDescription() {
    return "Lv: " + getLevel() + ", MaxHP: " + getMaxHP() + ", " +
    "At night, it attacks monsters for " + getPower() + " damage. "
            + "Attack distance is " + attackDistance() + ". "
            + "Attack " + getAttackCount() + " monsters at once. "
            + "Upgrade increases HP, damage, and sometimes attack distance." +
            " High leveled mages learned to attack multiple creatures.";
  }

  @Override
  public Image getImage() {
    return ImageUtility.loadImage("resources/pictures/sprite/mage/mage.png");
  }

  @Override
  public boolean canUpgrade() {
    if (getLevel() < 10) return true;
    return false;
  }

  @Override
  public int getUpgradeCost() {
    return getLevel() * 100 + 100;
  }

  @Override
  public int getMaxHP() {
    return 300 + getLevel() * 200;
  }

  /**
   * Retrieves the damage done by this creature
   */
  @Override
  public int getPower() {
    return 15 + getLevel() * 8;
  }

  /**
   * Retrieves attack distance
   */
  @Override
  public int attackDistance() {
    if (getLevel() >= 10) return 10;
    if (getLevel() >= 9) return 8;
    if (getLevel() >= 8) return 7;
    if (getLevel() >= 7) return 6;
    if (getLevel() >= 6) return 5;
    if (getLevel() >= 4) return 4;
    if (getLevel() >= 2) return 3;
    return 2;
  }

  /**
   * Retrieves attack count
   */
  @Override
  public int getAttackCount() {
    if (getLevel() >= 8) {
      return 2;
    }
    return 1;
  }

}
